<include file="Public/head" />
	<div class="tableContainer">
		<div class="tablePanel">
			<div class="edit-title">
				<!-- 有title-icon1至title-icon14共14个图标可供选择 -->
				<span class="title-icon10"></span>
				<div>&nbsp;&nbsp;<{:$item['id']?'修改':'添加'}><{$module_name_zh}></div>
			</div>
	        <form id="memberform" onsubmit="return false;">
	            <input type="hidden" name="info[id]" value="<{$item.id}>"/>
				<div class="edit-body">
					<div class="set-line">
						<div class="set-title">车型图片：</div>
						<div class="set-ctrl">
							<div class="uploadWrapper">点击上传
								<input class="uploadFile" type="file" id="pic" name="pic" onchange="upload_img('pic',400,240)" />
							</div>
							<input type="hidden" name="info[pic]" value="<{$item.pic}>" />
							<span style="color:#666;">&nbsp;&nbsp;&nbsp;建议尺寸 400x240像素</span>
						</div>
					</div>
					<div class="set-line" style="<{:$item['pic']?'':'display:none;'}>">
						<div class="set-title"></div>
						<div class="set-ctrl">
							<div class="showImgDiv">
								<img src="<{$item.pic}>" />
							</div>
						</div>
					</div>
					<div class="set-line">
						<div class="set-title">车型名称：</div>
						<div class="set-ctrl">
							<input name="info[name]" value="<{$item.name}>" type="text" maxlength="30" />
						</div>
					</div>
					<div class="set-line">
						<div class="set-title">官方指导价：</div>
						<div class="set-ctrl">
							<input name="info[official_price]" value="<{$item.official_price}>" type="text" placeholder="请输入整数值" /> 元
						</div>
					</div>
					<div class="set-line">
						<div class="set-title">本店优惠价：</div>
						<div class="set-ctrl">
							<input name="info[benefit_price]" value="<{$item.benefit_price}>" type="text" placeholder="请输入整数值" /> 元
						</div>
					</div>
					<div class="set-line">
						<div class="set-title">外链：</div>
						<div class="set-ctrl">
							<input name="info[url]" value="<{$item.url}>" type="text" placeholder="请输入车型官网链接" />
						</div>
					</div>
					<div class="set-line">
						<div class="set-title">序号：</div>
						<div class="set-ctrl">
							<input name="info[order_num]" value="<{$item.order_num|default='20'}>" type="text" /> 序号越小显示越靠前
						</div>
					</div>
					<div class="clearfloat"></div>
					<div class="save">
						<span id="save" class="saveBtn" onclick="save(this)">保 存</span>
					</div>
				</div>
			</form>
		</div>
	</div>
	<!-- 上传图片开始 -->
	<script type='text/javascript' src='__PUBLIC__/js/ajaxfileupload.js'></script>
	<script type="text/javascript">
	    //width height 要压缩成的图片宽 高，默认0代表不限制
	    function upload_img(id, width, height){
	        if(id == '' || id == null) return;
	        if(!width) width = 0;
	        if(!height) height = 0;

	        var loadIndex = layer.load(1);
	        $.ajaxFileUpload ({
	             url: '<{:U("Admin/PicUpload/index")}>',
	             data: {width: width, height: height},
	             secureuri: false,
	             fileElementId: id,
	             dataType: 'json',
	             success: function (data,status){
	                layer.close(loadIndex);
	                if(data.status){
						$('#'+id).parents('.set-line').next().children().find('img').attr('src',data.info);
						$('#'+id).parents('.set-line').next().show();
		                $('#'+id).parent().siblings('input').val(data.info);
	                }else{
	                    note_info(data.info,$('#'+id),'warn')
	                }
	             }
	        });
	    }
	</script>
	<!-- 上传图片结束 -->
	<script>
	function save(obj){
	    var loadIndex = layer.load(1);
	    $.post('<{:U("")}>',$('#memberform').serialize(),function(res){
	        layer.close(loadIndex);
	        if(res.status == 1){
	            note_info(res.info,obj);
	            setTimeout('window.location.href="<{:U('index')}>"',1200);
	        }else{
	            note_info(res.info,obj,'warn');
	        }
	    },'json');
	}
	</script>
<include file="Public/foot" />